

namespace PolicyAlgebra.Type
{
	///<summary>
	///    This class represents an object, as defined by the algebra.
	///</summary>
	public class Object : Commentable 
	{ 
		// Type of the object (e.g. a 'file' or 'check').
		private Type type;

		// The level of confidentiality that should be bound to the object.
		private string level;

		// The classification of the object.
		private string classification;


		///<summary>
		/// Constructor.
		///</summary>
		///<param name="name">The object's name</param>
		public Object(string name) : base(name) 
		{
			this.type = new Type();
		}


		///<summary>
		/// Constructor.
		///</summary>
		///<param name="name">The object's name</param>
		///<param name="type">The object's type</param>
		public Object(string name, string type) : this(name)
		{
			this.type = new Type(type);
		}


		///<summary>
		/// Constructor.
		///</summary>
		///<param name="name">The object's name</param>
		///<param name="type">The object's type</param>
		///<param name="comment">A comment to attach to this object</param>
		public Object(string name, string type, string comment) : base(name, comment)
		{
			this.type = new Type(type);
		}

		///<summary>
		/// Property for read only access to the object's specified 
		/// type (e.g. a 'file' or 'check').
		///</summary>
		public string Type
		{
			get
			{
				return type.Name;
			}
		}

		///<summary>
		/// Transforms an instance to its textual representation.
		///</summary>
		///<returns>The instance's textual representation</returns>
		public override string ToString()
		{
			// XXX : Simply to shut the compiler up. Will be
			//       removed later when MLS portions are implemented
			//       in full glory.
			if (null == level && null == classification) {
				classification = null;
				level = null;
			};

			string ret = base.ToString() + ":<" + type.Name + ">";
			return ret;
		}
	}
}
